University of South Florida
For using Git/Github and Unix, install wsl2
Turn Windows features on or off
If you have already installed wsl previously, check status with wsl —-status and confirm you are using wsl2.
Ctrl + Shift + PImportant
You should also create an account on GitHub. Optionally, register with USF for a student previleges.
Check if terminal understands git command. Type git on terminal and confirm no error message.
Make sure you are able to login to Github.
Distributed version control system, created by Linus Torvalds (2005)
“Track changes” made by team members, merge into main, etc.
Considered a “must” for software development, and many data science projects.
Has a learning curve, but it’s worth learning even for solo projects.
An online hosting platform that is based on Git system
Easy to browse other repositories (public, free)
Others: GitLab, Bitbucket, GitBucket, etc…
Version control: track changes, revert to previous versions
Collaboration: multiple people can work on the same project
Backup: store your project on the cloud
Portfolio: showcase your work to potential employers
Open source: contribute to other projects
Nope.
Git can be done completely locally (w/o internet).
GitHub deploys Git to online cloud system.
Git is primarily designed to handle text files and tracks changes line by line.
It can upload binary files (e.g. images, pdfs), but doesn’t track differences like text files.
GitHub has a file size limit (100MB)
It is intended for code tracking; large data should be stored elsewhere
Usually performed for the first time downloading from the remote repository.
git init is used to initialize a new git repository from current working directory.
git add stages files for commit.
git commit creates your project’s version, or a hash block. You must provide message folling -m.
git remote add adds remote repository.
origin is naming convention for Github remote repo.git push sends your commit to the remote repository.
git pull does two operations altogether:
git status shows the status of changes as untracked, modified, or staged.
git log shows the history of commits and its corresponding hashes.
When you want to get back to previous commit (version) B
git reset Bgit reset --mixed Bgit reset --soft Bgit reset --hard BName the folder nicely
Create subfolders as:
In R folder, create “my_first_R_code.R” file
and check the status and log on your directory:
Check your status and see the difference
It creates a “version”, a check-point of your project.
Check your status and log also:
Check your branches from current directory with
Browse your branches now again, and check the differences
Browse your github site that files are uploaded.
https://github.com/yourGithubId/Reponame.git
Note
By default, git will only track files, not empty folders. Folders are tracked when files are in it.
Now, make changes to your R\>my_first_R_code.R file:
print("Hello world!") in the code and save.Then add, commit, and push to the github.
Now, suppose your second commit (version) was an error.
You can come back to previous commit by:
or
At now, ONLY your local computer is back to the time when before the second commit. Your Github remote is in the future status (ahead) yet!
If you want your remote to be back to the first commit as well:
Note that you should use --force option here.
When using github from other apps (e.g. Positron, VScode, etc), you’ll use PAT (personal access token) instead of password.
FIN4770: Programming for FinTech